<template>
  <router-link
    :to="{name: 'classDetail',query: {classId: item.ClassId, title: item.ClassName}}"
    tag="div"
    class="class-item"
  >
    <div class="class-img-box">
      <img
        v-lazy="item.ImgUrl"
        class="class-img"
      >
    </div>
    <div class="class-info-box">
      <div class="class-name">
        {{ item.ClassName }}
      </div>
      <div class="discount-item">
        奖学金折扣后
        <span class="price">￥{{ item.DiscountPrice }}</span>
      </div>
      <div class="cost-people">
        <span class="cost">￥{{ item.ClassPrice }}</span>
        <span>{{ item.ClassPeople }}人购买</span>
      </div>
    </div>
  </router-link>
</template>
<script lang="ts">
import Vue from 'vue'
import { SET_PAYINFO } from '@/store/mutations'
export default Vue.extend({
  props: {
    item: {
      default: () => ({}),
      type: Object,
    },
  },
})
</script>

<style lang="scss" scoped>
.class-item {
  display: flex;
  justify-content: space-between;
  position: relative;
  height: 150px;
  width: 100%;
  margin-bottom: 40px;
  align-items: center;
}
.class-item:last-child {
  margin-bottom: 0;
}
.class-img-box {
  width: 250px;
  height: 150px;
}
.class-img {
  width: 100%;
  border-radius: 6px;
}
.class-info-box {
  width: calc(100% -270px);
}
.class-name {
  width: 100%;
  color: #333333;
  font-size: 32px;
  font-weight: 400;
  padding-top: 5px;
  @include ellipsis;
}
.discount-item {
  font-size: 24px;
  color: #666666;
  padding-top: 28px;
  .price {
    font-size: 30px;
    color: #BA2401;
  }
}
.cost-people {
  display: flex;
  justify-content: space-between;
  font-size: 24px;
  color: #A4A9B2;
  margin-top: 16px;
  .cost {
    text-decoration: line-through;
  }
}
</style>
